package org.ligson.springboot.simple;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Cacheable(cacheManager = "caffeineCacheManager", key = "#{T(org.ligson.springboot.simple.UserService).convertCode(code)}", cacheNames = "users")
    public User findByUserName(String code) {
        System.out.println("p00-0000");
        System.out.println("p00-0000");
        return new User();
    }

    public static String convertCode(String code) {
        System.out.println("000000000000");
        System.out.println(code);
        return code + "-----";
    }
}
